package com.atguigu.p1;

public class Account {

	//属性
	private double balance;//余额
	
	//构造器
	public Account()
	{
		
	}
	//构造器里设置余额balance
	public Account(double balance)
	{
		this.balance = balance;
	}
	
	//获取余额
	public double getBalance()
	{
		return balance;
	}
	
	//存钱操作
	public void deposit(double amt)
	{
		if(amt > 0)
		{
			balance+=amt;
			System.out.println("存钱成功");
		}
	}
	
	//取钱操作
	public void withdraw(double amt)
	{
		if(balance >= amt)
		{
			balance-=amt;
			System.out.println("取钱成功");
		}
		else
		{
			System.out.println("余额不足");
		}
	}
}
